#ifndef _INETFRAME_H_
#define _INETFRAME_H_


#define DNS_PROC_RES_NOERROR S_SUCCESS
#define DNS_PROC_RES_ERROR   S_ERROR

interface IDnsProc : public IBase
{
    std_method(OnGetHost)(crterr err, LPCSTR hostname, LPCSTR host) PURE;
};

// {92EBBD6E-BF4D-41EC-9DFB-07C9AFF0CCC0}
_DEF_IID(IID_IDnsProc, 0x92ebbd6e, 0xbf4d, 0x41ec, 0x9d, 0xfb, 0x7, 0xc9, 0xaf, 0xf0, 0xcc, 0xc0);

interface IDns : public IBase
{
    std_method(Post)(LPCSTR hostname, IBase * pProc) PURE;
    std_method(Close)() PURE;
};

// {510FD0EA-BAE2-4BC8-B650-76E8FD5ED853}
_DEF_IID(IID_IDns, 0x510fd0ea, 0xbae2, 0x4bc8, 0xb6, 0x50, 0x76, 0xe8, 0xfd, 0x5e, 0xd8, 0x53);

// {99148517-E9AB-4F72-A2E3-012625A35E95}
_DEF_CLSID(CLSID_IDns, 0x99148517, 0xe9ab, 0x4f72, 0xa2, 0xe3, 0x1, 0x26, 0x25, 0xa3, 0x5e, 0x95);

// {13429C36-9903-42D1-AD82-F243D48E1A76}
_DEF_CLSID(CLSID_IWebSocket, 0x13429c36, 0x9903, 0x42d1, 0xad, 0x82, 0xf2, 0x43, 0xd4, 0x8e, 0x1a, 0x76);


typedef long ChannelId;

interface IChannel : public IBase
{
    std_method_(ChannelId, CreateChannel)() PURE;
    std_method(CloseChannel)(ChannelId id) PURE;
    std_method_(ssize_t, SendChannel)(ChannelId id, char* buf, size_t len) PURE;
    std_method_(ssize_t, RecvChannel)(ChannelId id, char* buf, size_t len) PURE;
};

// {7EB8185F-0F4E-4420-9991-B70671967377}
_DEF_IID(IID_IChannel, 0x7eb8185f, 0xf4e, 0x4420, 0x99, 0x91, 0xb7, 0x6, 0x71, 0x96, 0x73, 0x77);

// {4A27FA11-BEA7-46E8-9F32-EC0C9F6E1A9E}
_DEF_CLSID(CLSID_Channel, 0x4a27fa11, 0xbea7, 0x46e8, 0x9f, 0x32, 0xec, 0xc, 0x9f, 0x6e, 0x1a, 0x9e);


interface IModBusProc : public IBase{};

// {9A102441-E383-4B3C-8CC8-7C8E0B0162FF}
_DEF_IID(IID_IModBusProc, 0x9a102441, 0xe383, 0x4b3c, 0x8c, 0xc8, 0x7c, 0x8e, 0xb, 0x1, 0x62, 0xff);

interface IModBus : public IBase{};

// {9b102441-E383-4B3C-8CC8-7C8E0B0162FF}
_DEF_IID(IID_IModBus, 0x9b102441, 0xe383, 0x4b3c, 0x8c, 0xc8, 0x7c, 0x8e, 0xb, 0x1, 0x62, 0xff);

interface IModBusSrvProc : public IBase
{
    std_method(OnAccept)(int error, LPCSTR hostname, LPCSTR host) PURE;
};

// {9b102441-E383-4B3C-8CC8-7C8E0B0162FF}
_DEF_IID(IID_IModBusSrvProc, 0x9c102441, 0xe383, 0x4b3c, 0x8c, 0xc8, 0x7c, 0x8e, 0xb, 0x1, 0x62, 0xff);

interface IID_IModBusSrv : public IBase{};

// {9d102441-E383-4B3C-8CC8-7C8E0B0162FF}
_DEF_IID(IID_IModBusSrv, 0x9d102441, 0xe383, 0x4b3c, 0x8c, 0xc8, 0x7c, 0x8e, 0xb, 0x1, 0x62, 0xff);


enum NetProtocol {

    protocol_base = 0,
    protocol_dns = 2,
    protocol_modbus = 3,

    protocol_http = 100,
    protocol_http_s = 101,
    protocol_https = 110,
    protocol_https_s = 111,
    protocol_websocket = 150

};

interface INetFrame : public IBase
{
    std_method(Create)(int type, IBase * *pBase) PURE;
};

// {7EB8185F-0F4E-4420-9991-B70671967377}
_DEF_IID(IID_INetFrame, 0x7eb8185f, 0xf4e, 0x4420, 0x99, 0x91, 0xb7, 0x6, 0x71, 0x96, 0x73, 0x77);

// {C54C9CC0-F448-4A49-A622-0467D02E8EB8}
_DEF_CLSID(CLSID_INetFrame, 0xc54c9cc0, 0xf448, 0x4a49, 0xa6, 0x22, 0x4, 0x67, 0xd0, 0x2e, 0x8e, 0xb8);

#endif
